package com.student.demo.controller;

import com.student.demo.config.Result;
import com.student.demo.dto.StudentGradeDTO;
import com.student.demo.entity.StudentGrade;
import com.student.demo.entity.StudentInfo;
import com.student.demo.service.IStudentGradeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@Slf4j
@RestController
@RequestMapping("/stuGrade")
public class StudentGradeController {
    @Resource
    private IStudentGradeService studentGradeService;

    @PostMapping("/insert")
    public Result<?> insert(@RequestBody(required = false) StudentGrade studentGrade) {
        return studentGradeService.insert(studentGrade);
    }

    @DeleteMapping("/delInfo/{id}")
    public Result<?> delById(@PathVariable("id") Long id) {
        return studentGradeService.delInfo(id);
    }

    @PutMapping("/updateInfo")
    public Result<?> updateInfo(@RequestBody(required = false) StudentGrade studentGrade) {
        return studentGradeService.updateInfo(studentGrade);
    }

    @PostMapping("/listPage")
    public Result<?> listPage(@RequestBody(required = false) StudentGradeDTO studentGradeDTO) {
        return studentGradeService.listPage(studentGradeDTO);
    }
}
